unit UAssignOpToPatient;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvPanel, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
  dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinXmas2008Blue, cxGroupBox, DBAdvGlowNavigator,
  cxStyles, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage,
  cxNavigator, Data.DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, Vcl.StdCtrls, cxDBEdit, UDMItems, UDMPerson, cxSpinEdit,
  cxCalendar, cxTimeEdit, cxCurrencyEdit, cxCheckBox, Vcl.DBCtrls;

type
  TFAssignOpToPatient = class(TForm)
    AdvPanel1: TAdvPanel;
    AdvPanelStyler1: TAdvPanelStyler;
    cxGroupBox1: TcxGroupBox;
    AdvPanel2: TAdvPanel;
    DBAdvGlowNavigator1: TDBAdvGlowNavigator;
    Label1: TLabel;
    cxDBTextEdit1: TcxDBTextEdit;
    Label2: TLabel;
    cxDBLookupComboBox1: TcxDBLookupComboBox;
    Label3: TLabel;
    cxDBLookupComboBox2: TcxDBLookupComboBox;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    cxDBLookupComboBox3: TcxDBLookupComboBox;
    cxDBLookupComboBox4: TcxDBLookupComboBox;
    Label8: TLabel;
    cxDBLookupComboBox5: TcxDBLookupComboBox;
    Label9: TLabel;
    cxDBLookupComboBox6: TcxDBLookupComboBox;
    cxDBLookupComboBox7: TcxDBLookupComboBox;
    cxDBSpinEdit1: TcxDBSpinEdit;
    cxDBCurrencyEdit1: TcxDBCurrencyEdit;
    cxDBCurrencyEdit2: TcxDBCurrencyEdit;
    cxDBCurrencyEdit3: TcxDBCurrencyEdit;
    cxDBCurrencyEdit4: TcxDBCurrencyEdit;
    cxDBCurrencyEdit5: TcxDBCurrencyEdit;
    Label10: TLabel;
    cxDBDateEdit1: TcxDBDateEdit;
    Label11: TLabel;
    cxDBTimeEdit1: TcxDBTimeEdit;
    Label12: TLabel;
    cxSpinEdit1: TcxSpinEdit;
    DBCheckBox1: TDBCheckBox;
    procedure DBAdvGlowNavigator1BtnCancel(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnEdit(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnFirst(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnInsert(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnLast(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnNext(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnPost(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnPrior(Sender: TObject);
    procedure DBAdvGlowNavigator1BtnRefresh(Sender: TObject);
    procedure cxSpinEdit1PropertiesChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FAssignOpToPatient: TFAssignOpToPatient;

implementation

{$R *.dfm}

procedure TFAssignOpToPatient.cxSpinEdit1PropertiesChange(Sender: TObject);
begin
  if self.cxSpinEdit1.Value = 1  then
  begin
    Self.Label5.Visible := False;
    Self.Label8.Visible := False;
    Self.Label9.Visible := False;
    Self.cxDBLookupComboBox4.Visible := False;
    Self.cxDBLookupComboBox5.Visible := False;
    Self.cxDBLookupComboBox6.Visible := False;
    Self.cxDBCurrencyEdit3.Visible := False;
    Self.cxDBCurrencyEdit4.Visible := False;
    Self.cxDBCurrencyEdit5.Visible := False;
  end
  else if self.cxSpinEdit1.Value = 2  then
  begin
    Self.Label5.Visible := True;
    Self.Label8.Visible := False;
    Self.Label9.Visible := False;
    Self.cxDBLookupComboBox4.Visible := True;
    Self.cxDBLookupComboBox5.Visible := False;
    Self.cxDBLookupComboBox6.Visible := False;
    Self.cxDBCurrencyEdit3.Visible := True;
    Self.cxDBCurrencyEdit4.Visible := False;
    Self.cxDBCurrencyEdit5.Visible := False;
  end
  else if self.cxSpinEdit1.Value = 3  then
  begin
    Self.Label5.Visible := True;
    Self.Label8.Visible := True;
    Self.Label9.Visible := False;
    Self.cxDBLookupComboBox4.Visible := True;
    Self.cxDBLookupComboBox5.Visible := True;
    Self.cxDBLookupComboBox6.Visible := False;
    Self.cxDBCurrencyEdit3.Visible := True;
    Self.cxDBCurrencyEdit4.Visible := True;
    Self.cxDBCurrencyEdit5.Visible := False;
  end
  else if self.cxSpinEdit1.Value = 4  then
  begin
    Self.Label5.Visible := True;
    Self.Label8.Visible := True;
    Self.Label9.Visible := True;
    Self.cxDBLookupComboBox4.Visible := True;
    Self.cxDBLookupComboBox5.Visible := True;
    Self.cxDBLookupComboBox6.Visible := True;
    Self.cxDBCurrencyEdit3.Visible := True;
    Self.cxDBCurrencyEdit4.Visible := True;
    Self.cxDBCurrencyEdit5.Visible := True;
  end;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnCancel(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMItems.his_items_encounter_op.Cancel;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnEdit(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := true;
  DMItems.his_items_encounter_op.Edit;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnFirst(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMItems.his_items_encounter_op.First;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnInsert(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := true;
  DMItems.his_items_encounter_op.Insert;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnLast(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMItems.his_items_encounter_op.Last;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnNext(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMItems.his_items_encounter_op.Next;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnPost(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := true;
  DMItems.his_items_encounter_op.Post;
  DMItems.his_items_encounter_op.RefreshRecord;
  Self.AdvPanel1.Enabled := false;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnPrior(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMItems.his_items_encounter_op.Prior;
end;

procedure TFAssignOpToPatient.DBAdvGlowNavigator1BtnRefresh(Sender: TObject);
begin
  Self.AdvPanel1.Enabled := false;
  DMItems.his_items_encounter_op.RefreshRecord;
end;

end.
